/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Harold
 */
@Entity
@Table(name = "in_op_cen")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InOpCen.findAll", query = "SELECT i FROM InOpCen i"),
    @NamedQuery(name = "InOpCen.findByIdOpCen", query = "SELECT i FROM InOpCen i WHERE i.idOpCen = :idOpCen"),
    @NamedQuery(name = "InOpCen.findByIdTypeCurrency", query = "SELECT i FROM InOpCen i WHERE i.idTypeCurrency = :idTypeCurrency"),
    @NamedQuery(name = "InOpCen.findByName", query = "SELECT i FROM InOpCen i WHERE i.name = :name"),
    @NamedQuery(name = "InOpCen.findByDescription", query = "SELECT i FROM InOpCen i WHERE i.description = :description"),
    @NamedQuery(name = "InOpCen.findByState", query = "SELECT i FROM InOpCen i WHERE i.state = :state")})
public class InOpCen implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_op_cen")
    private Integer idOpCen;
    @OneToOne
    @JoinColumn(name = "id_type_currency")
    private TypeCurrency idTypeCurrency;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "name")
    private String name;
    @Size(max = 256)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "state")
    private boolean state;

    public InOpCen() {
    }

    public InOpCen(Integer idOpCen) {
        this.idOpCen = idOpCen;
    }

    public InOpCen(Integer idOpCen, TypeCurrency idTypeCurrency, String name, boolean state) {
        this.idOpCen = idOpCen;
        this.idTypeCurrency = idTypeCurrency;
        this.name = name;
        this.state = state;
    }

    public Integer getIdOpCen() {
        return idOpCen;
    }

    public void setIdOpCen(Integer idOpCen) {
        this.idOpCen = idOpCen;
    }

    public TypeCurrency getIdTypeCurrency() {
        return idTypeCurrency;
    }

    public void setIdTypeCurrency(TypeCurrency idTypeCurrency) {
        this.idTypeCurrency = idTypeCurrency;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean getState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOpCen != null ? idOpCen.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InOpCen)) {
            return false;
        }
        InOpCen other = (InOpCen) object;
        if ((this.idOpCen == null && other.idOpCen != null) || (this.idOpCen != null && !this.idOpCen.equals(other.idOpCen))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.InOpCen[ idOpCen=" + idOpCen + " ]";
    }
    
}
